package com.qiyi.player.base.utils
{
   public class UUID extends Object
   {
      
      public function UUID() {
         super();
      }
      
      public static function createUUID() : String {
         var _loc1_:Array = new Array("8","9","A","B");
         var _loc2_:String = createRandomIdentifier(8,15) + "-" + createRandomIdentifier(4,15) + "-4" + createRandomIdentifier(3,15) + "-" + _loc1_[randomIntegerWithinRange(0,3)] + createRandomIdentifier(3,15) + "-" + createRandomIdentifier(12,15);
         return _loc2_;
      }
      
      private static function createRandomIdentifier(param1:uint, param2:uint = 61) : String {
         var _loc3_:Array = new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
         var _loc4_:Array = new Array();
         var param2:uint = param2 > 61?61:param2;
         while(param1--)
         {
            _loc4_.push(_loc3_[randomIntegerWithinRange(0,param2)]);
         }
         return _loc4_.join("");
      }
      
      private static function randomWithinRange(param1:Number, param2:Number) : Number {
         return param1 + Math.random() * (param2 - param1);
      }
      
      private static function randomIntegerWithinRange(param1:int, param2:int) : int {
         return Math.round(randomWithinRange(param1,param2));
      }
   }
}
